home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December / PCWorld_2005-12_cd.bin / software / temacd / tiny / tpf-6[1].5.126.exe / Tiny Firewall 2005.msi / webui.dll / FIREWALL / FWN-TOOLS.XSL < prev    next >
Encoding:
Extensible Markup Language  |  2005-08-17  |  22.6 KB  |  260 lines

  1.  ■<?xml version="1.0"?>
  2. <!--
  3. /*//////////////////////////////////////////////////////////////////////
  4. Filename:          fwn-tools.xsl
  5. Company Name:      Computer Associates International, Inc.
  6. Legal Copyright: Copyright (c) Computer Associates International, Inc.
  7. Author:          Marek Matus (marek.matus@ca.com)
  8. Product:          Tiny Firewall
  9. Description:      
  10. ///////////////////////////////////////////////////////////////////////*/
  11.  -->
  12.  
  13. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  14.         <xsl:output method="html"/>
  15.         
  16.         <!--<xsl:include href="../common/tools.xsl"/>-->
  17.         <xsl:variable name="INCLUDED_FILES">../common/tools.xsl</xsl:variable>
  18.         
  19.         <xsl:variable name="templateName" select="//Params/Param[@name='templateName']"/>
  20.         <xsl:variable name="name" select="//Params/Param[@name='name']"/>
  21.         
  22.         <xsl:template match="/">              
  23.         
  24.             <xsl:choose>
  25.                 <xsl:when test="$templateName='getTransportListArray'">                    
  26.                     <xsl:call-template name="getTransportListArray"/>
  27.                 </xsl:when>
  28.                 <xsl:when test="$templateName='getTransportListArrayInDir'">                    
  29.                     <xsl:call-template name="getTransportListArrayInDir"/>
  30.                 </xsl:when>
  31.                 <xsl:when test="$templateName='getWordListArray'">                    
  32.                     <xsl:call-template name="getWordListArray"/>
  33.                 </xsl:when>
  34.                 <xsl:when test="$templateName='getTransportListArrayTCPUDP'">
  35.                     <xsl:call-template name="getTransportListArrayTCPUDP"/>
  36.                 </xsl:when>
  37.                 <xsl:when test="$templateName='getTransportListArrayTCPUDPDirIn'">
  38.                     <xsl:call-template name="getTransportListArrayTCPUDPDirIn"/>
  39.                 </xsl:when>
  40.                 <xsl:when test="$templateName='getIPListArray'">                    
  41.                     <xsl:call-template name="getIPListArray"/>
  42.                 </xsl:when>   
  43.                 <xsl:when test="$templateName='getTimesListArray'">                    
  44.                     <xsl:call-template name="getTimesListArray"/>
  45.                 </xsl:when>    
  46.                 <xsl:when test="$templateName='getAppListArray'">                    
  47.                     <xsl:call-template name="getAppListArray"/>
  48.                 </xsl:when>    
  49.                 <xsl:when test="$templateName='getAppGroupListArray'">                    
  50.                     <xsl:call-template name="getAppGroupListArray"/>
  51.                 </xsl:when>
  52.                 <xsl:when test="$templateName='isObjNameUnique'">
  53.                     <xsl:call-template name="isObjNameUnique">
  54.                         <xsl:with-param name="name" select="$name"/>
  55.                     </xsl:call-template>
  56.                 </xsl:when>
  57.             </xsl:choose>
  58.                         
  59.         </xsl:template>
  60.         
  61.         <!-- Get list of transport objects -->        
  62.         <xsl:template name="getTransportListArray">
  63.             <xsl:text>new Array(</xsl:text>
  64.                 <xsl:for-each select="//Definitions/Object[@ot='iptransport']">                    
  65.                     <xsl:sort select="@id"/>
  66.                     
  67.                     <xsl:if test="position()>1">
  68.                         <xsl:text>,</xsl:text>
  69.                     </xsl:if>
  70.                     <xsl:text>'</xsl:text>
  71.                     
  72.                     <xsl:call-template name="printJSText">
  73.                         <xsl:with-param name="string" select="@id"/>
  74.                     </xsl:call-template>
  75.                     
  76.                     <xsl:text>'</xsl:text>
  77.                 </xsl:for-each>       
  78.             <xsl:text>)</xsl:text>
  79.         </xsl:template>
  80.         
  81.         <xsl:template name="getTransportListArrayInDir">
  82.             <xsl:text>new Array(</xsl:text>
  83.                 <xsl:for-each select="//Definitions/Object[(Item/@dir='out' or Item/@dir='in_out') and @ot='iptransport']">                    
  84.                     <xsl:sort select="@id"/>
  85.                     
  86.                     <xsl:if test="position()>1">
  87.                         <xsl:text>,</xsl:text>
  88.                     </xsl:if>
  89.                     <xsl:text>'</xsl:text>
  90.                     
  91.                     <xsl:call-template name="printJSText">
  92.                         <xsl:with-param name="string" select="@id"/>
  93.                     </xsl:call-template>
  94.                     
  95.                     <xsl:text>'</xsl:text>
  96.                 </xsl:for-each>       
  97.             <xsl:text>)</xsl:text>
  98.         </xsl:template>
  99.         
  100.         <!-- Get list of word objects -->        
  101.         <xsl:template name="getWordListArray">
  102.             <xsl:text>new Array(</xsl:text>
  103.                 <xsl:for-each select="//Definitions/Object[@ot='content_filter']">                    
  104.                     <xsl:sort select="@id"/>
  105.                     
  106.                     <xsl:if test="position()>1">
  107.                         <xsl:text>,</xsl:text>
  108.                     </xsl:if>
  109.                     <xsl:text>'</xsl:text>
  110.                     
  111.                     <xsl:call-template name="printJSText">
  112.                         <xsl:with-param name="string" select="@id"/>
  113.                     </xsl:call-template>
  114.                     
  115.                     <xsl:text>'</xsl:text>
  116.                 </xsl:for-each>       
  117.             <xsl:text>)</xsl:text>
  118.         </xsl:template>
  119.         <!-- Get list of transport objects where protocol is noly TCP, UDP or TCP-UDP -->
  120.         <xsl:template name="getTransportListArrayTCPUDP">
  121.             <xsl:text>new Array(</xsl:text>
  122.                 <xsl:for-each select="//Definitions/Object[@ot='iptransport' and (Item/@prot='tcp' or Item/@prot='udp' or Item/@prot='tcp_udp')]">
  123.                     <xsl:sort select="@id"/>
  124.                     <xsl:if test="position()>1">
  125.                         <xsl:text>,</xsl:text>
  126.                     </xsl:if>
  127.                     <xsl:text>'</xsl:text>
  128.                     <xsl:call-template name="printJSText">
  129.                         <xsl:with-param name="string" select="@id"/>
  130.                     </xsl:call-template>
  131.                     <xsl:text>'</xsl:text>
  132.                 </xsl:for-each>
  133.             <xsl:text>)</xsl:text>
  134.         </xsl:template>
  135.         
  136.         <xsl:template name="getTransportListArrayTCPUDPDirIn">
  137.             <xsl:text>new Array(</xsl:text>
  138.                 <xsl:for-each select="//Definitions/Object[(Item/@dir='out' or Item/@dir='in_out') and @ot='iptransport' and (Item/@prot='tcp' or Item/@prot='udp' or Item/@prot='tcp_udp')]">
  139.                     <xsl:sort select="@id"/>
  140.                     <xsl:if test="position()>1">
  141.                         <xsl:text>,</xsl:text>
  142.                     </xsl:if>
  143.                     <xsl:text>'</xsl:text>
  144.                     <xsl:call-template name="printJSText">
  145.                         <xsl:with-param name="string" select="@id"/>
  146.                     </xsl:call-template>
  147.                     <xsl:text>'</xsl:text>
  148.                 </xsl:for-each>
  149.             <xsl:text>)</xsl:text>
  150.         </xsl:template>
  151.         <!-- Get list of predefined IP objects -->
  152.         <xsl:template name="getIPListArray">                                         
  153.             <xsl:text>new Array(</xsl:text>
  154.                 <xsl:for-each select="//Definitions/Object[@ot='ipaddress' and not(starts-with(@id,'User:') or starts-with(@id,'RUser:') or starts-with(@id,'Group:') or starts-with(@id,'RGroup:'))]">                
  155.                     <xsl:sort select="@id"/>
  156.                     
  157.                     <xsl:if test="position()>1">
  158.                         <xsl:text>,</xsl:text>
  159.                     </xsl:if>
  160.                     <xsl:text>'</xsl:text>
  161.                     
  162.                     <xsl:call-template name="printJSText">
  163.                         <xsl:with-param name="string" select="@id"/>
  164.                     </xsl:call-template>
  165.                     
  166.                     <xsl:text>'</xsl:text>                
  167.                 </xsl:for-each>  
  168.             <xsl:text>)</xsl:text>
  169.         </xsl:template>             
  170.         
  171.                 <!-- Get list of transport objects, generate button list -->
  172.     <xsl:template name="getTimesListArray">                            
  173.             <xsl:text>new Array(</xsl:text>
  174.                 <xsl:for-each select="//Definitions/Object[@ot='time']">
  175.                     <xsl:sort select="@id"/>
  176.                     
  177.                     <xsl:if test="position()>1">
  178.                         <xsl:text>,</xsl:text>
  179.                     </xsl:if>
  180.                     <xsl:text>'</xsl:text>
  181.                     
  182.                     <xsl:call-template name="printJSText">
  183.                         <xsl:with-param name="string" select="@id"/>
  184.                     </xsl:call-template>
  185.                     
  186.                     <xsl:text>'</xsl:text>                
  187.                 </xsl:for-each>       
  188.             <xsl:text>)</xsl:text>
  189.         </xsl:template>
  190.         <!-- get list of application -->
  191.         <xsl:template name="getAppListArray">
  192.             <xsl:text>new Array(</xsl:text>    
  193.                                                     
  194.             <xsl:for-each select="//LabelList/Label">
  195.                 <xsl:sort select="@id"/>
  196.                 
  197.                 <xsl:if test="position()>1">
  198.                     <xsl:text>,</xsl:text>
  199.                 </xsl:if>
  200.                 <xsl:text>'</xsl:text>
  201.                     
  202.                 <xsl:call-template name="printJSText">
  203.                     <xsl:with-param name="string" select="@id"/>
  204.                 </xsl:call-template>
  205.                 
  206.                 <xsl:text>'</xsl:text>
  207.             </xsl:for-each>
  208.             
  209.             <xsl:text>)</xsl:text>
  210.         </xsl:template>
  211.         
  212.         <!-- get list of application groups -->
  213.         <xsl:template name="getAppGroupListArray">
  214.             <xsl:text>new Array(</xsl:text>    
  215.                                 
  216.             <xsl:for-each select="//GroupList/Group">
  217.                 <xsl:sort select="@id"/>
  218.                 
  219.                 <xsl:if test="position()>1">
  220.                     <xsl:text>,</xsl:text>
  221.                 </xsl:if>
  222.                 <xsl:text>'</xsl:text>
  223.                 
  224.                 <xsl:call-template name="printJSText">
  225.                     <xsl:with-param name="string" select="@id"/>
  226.                 </xsl:call-template>
  227.                 
  228.                 <xsl:text>'</xsl:text>
  229.             </xsl:for-each>                                   
  230.                                         
  231.             <xsl:text>)</xsl:text>
  232.         </xsl:template>
  233.         
  234.         <!-- Check if object name is unique. -->
  235.         <xsl:template name="isObjNameUnique">
  236.             <xsl:param name="name"/>
  237.             
  238.             <xsl:variable name="cnt" select="count(//Definitions/Object[@id=$name])"/>
  239.             <xsl:choose>
  240.                 <xsl:when test="$cnt=0">
  241.                     <xsl:text>true</xsl:text>
  242.                 </xsl:when>
  243.                 <xsl:otherwise>
  244.                     <xsl:text>false</xsl:text>
  245.                 </xsl:otherwise>
  246.             </xsl:choose>
  247.         </xsl:template>
  248. </xsl:stylesheet>